﻿Public Class ALINEAS

    Private Sub ALINEAS_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.ALINEASTableAdapter.Fill(Me.ALINEASDataSet.ALINEAS)
    End Sub
    Private Sub PRIMEIRO_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PRIMEIRO.Click
        ALINEASBindingSource.MoveFirst()
    End Sub
    Private Sub VOLTAR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VOLTAR.Click
        ALINEASBindingSource.MovePrevious()
    End Sub
    Private Sub NOVO_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NOVO.Click
        ALINEASBindingSource.AddNew()
    End Sub
    Private Sub SALVAR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SALVAR.Click
        Try
            Me.Validate()
            ALINEASBindingSource.EndEdit()
            TableAdapterManager.UpdateAll(Me.ALINEASDataSet)
        Catch ex As Exception
            MsgBox("ERRO AO ATUALIZAR OS DADOS " & ex.ToString)
        End Try
    End Sub
    Private Sub DELETAR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DELETAR.Click
        Try
            ALINEASBindingSource.RemoveCurrent()
            ALINEASTableAdapter.Update(ALINEASDataSet.ALINEAS)
        Catch EX As Exception
            MsgBox("ERRO AO DELETAR O REGISTRO " & EX.ToString)
        End Try
    End Sub

    Private Sub FRENTE_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FRENTE.Click
        ALINEASBindingSource.MoveNext()
    End Sub

    Private Sub ULTIMO_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ULTIMO.Click
        ALINEASBindingSource.MoveLast()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.ALINEASTableAdapter.Fill(Me.ALINEASDATASET.ALINEAS)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If ALINEATextBox.Text = "" Then
            MsgBox("Favor informar numero da alínea", MsgBoxStyle.Information, "Atenção")
        Else
            ALINEASTableAdapter.FillByALINEA(ALINEASDATASET.ALINEAS, ALINEATextBox.Text)
        End If
    End Sub
End Class